package com.young.serviceutil.utils;

import org.apache.commons.codec.binary.Base64;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class ImageBase64Util {

    public static String getImageString(String imageFile) {

        try (FileInputStream fileInputStream = new FileInputStream(new File(imageFile))) {
            byte[] data = new byte[fileInputStream.available()];
            return new String(Base64.encodeBase64(data));
        } catch (IOException e) {
        }
        return "";
    }

}
